/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tdtest.controls;

import javafx.scene.layout.VBox;
import tdtest.controls.factory.FunctionControlFactory;
import tdtest.controls.factory.GroupControlFactory;
import tdtest.controls.factory.VariableControlFactory;
import tdtest.data.*;

/**
 *
 * @author sutter
 */
public class DataStructureControl extends SystemComponentControl<TDDataStructure> {
	
	private ControlList<TDGroup<TDFunction>> functionControlList;
	private ControlList<TDGroup<TDVariable>> variableGroupList;
	private VBox content;
	
	public DataStructureControl(TDDataStructure dataStructure) {
		super(dataStructure);
		this.getStyleClass().add("data-structure-control");
		init(dataStructure);
	}
	
	private void init(TDDataStructure dataStructure) {
			
		content = new VBox();
		
		variableGroupList = new ControlList<>(dataStructure.variables, new GroupControlFactory(new VariableControlFactory()));
		variableGroupList.getStyleClass().add("data-structure-variable-list");
		content.getChildren().add(variableGroupList);
		
		functionControlList = new ControlList<>(dataStructure.functions, new GroupControlFactory(new FunctionControlFactory()));
		functionControlList.getStyleClass().add("data-structure-function-list");
		content.getChildren().add(functionControlList);
		
		content.getStyleClass().add("data-structure-content");
		
		this.setContent(content);
	}
	
}
